<script setup name="App" lang="ts">
import { computed, ComputedRef, reactive, Ref, ref } from 'vue';

const count = ref(100)
// const doubleCount = computed(() => count.value * 2)

// 第一种通过泛型函数，泛型函数的参数就表示返回值的类型
// const doubleCount = computed<number>(() => count.value * 2)

// 第二种通过类型注解配合 ComputedRef
const doubleCount: ComputedRef<string> = computed(() => (count.value * 2).toFixed(2))

</script>
<template>
  <div>doubleCount: {{ doubleCount }}</div>
</template>
